#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>

struct sigaction act, oact;

void handler(int signo)
{
	printf("get a signal:%d\n", signo);
	sigaction(2, &oact, NULL);
}

int main()
{
	memset(&act, 0, sizeof(act));
	memset(&oact, 0, sizeof(oact));

	act.sa_handler = handler;
	act.sa_flags = 0;

	sigemptyset(&act.sa_mask);
	sigaction(2, &act, &oact);

	while (1)
    {
		printf("I am a process...\n");
		sleep(1);
	}
    
	return 0;
}
